import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
    public static void main(String[] args) {
        Reader r=null;
        try{
             r=new FileReader("monijuanbc03/foodinfo.txt");
        }
        catch (IOException e)
        {
            e.printStackTrace();

        }
        if(r !=null)
        {
            BufferedReader br=new BufferedReader(r);
            try{
                String line=br.readLine();
                System.out.println("食物，每100毫克铁元素含量（毫克）");
                double max=0.0;
                String maxName="";
                while ((line=br.readLine())!=null)
                {
                   String[] strs=line.split(",");
                   //strs[0],strs[1],strs[2],strs[3]
                    int weight=Integer.parseInt(strs[2]);
                    double feWeight=Double.parseDouble(strs[3]);
                    double feWeightPer100=feWeight/weight*100;
                    if (feWeightPer100>max){
                        max=feWeightPer100;
                        maxName=strs[0];
                    }
                    System.out.println(strs[0]+ ","+feWeightPer100);




                }
                System.out.println("铁含量最高的食物是"+maxName+",铁元素含量为"+max);
            }
            catch (IOException e)
            {
                e.printStackTrace();

            }

        }
    }
}